#{extends 'overlay.html' /}
<div id="crudShow" class="${type.name}">
	<h2 id="crudShowTitle">&{'crud.show.title', type.modelName}</h2>
	<div class="objectForm">
	#{form action:@save(object.id), enctype:'multipart/form-data'}
		<a href="javascript:check_all_perms(true);">Check all</a>, <a href="javascript:check_all_perms(false);">uncheck all</a> or
		import permissions from: <select id="inherit" onchange="import_permissions($('#inherit :selected').val());">
			#{list project ? project.roles : roles}
				<option value="${_.id}" ${_ == object ? 'selected' : ''}>${_.name}</option>
			#{/list}
		</select> <img id="loading" style="display:none;" src="/public/images/ajax-loader.gif" />
		#{crud.form fields:['name', 'permissions'] /}
		<p class="crudButtons">
			<input type="submit" name="_save" value="&{'crud.save', type.modelName}" />
			<input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" />
		</p>
	#{/form}
	</div>
	#{ifnot x.baseRole}
	#{form @delete(object.id)}
		<p class="crudDelete">
			<input type="submit" value="&{'crud.delete', type.modelName}" onclick="return confirm('Are you sure you want to delete this role?');" />
		</p>
	#{/form}
	#{/ifnot}
</div>